using System;
using EPiServer.Common;
using EPiServer.Common.Queries;
using EPiServer.Common.Security;
using EPiServer.Community.StarViral;
using EPiServer.Community.StarViral.Queries;

namespace EPiAbstractions.Community.StarViral
{
    public interface IStarViralHandlerFacade
    {
        Referral AddReferral(Referral referral);

        void UpdateReferral(Referral referral);

        void RemoveReferral(Referral referral);

        ReferralCollection GetReferrals(Int32 page, Int32 pageSize, ReferralSortOrder[] sortOrder);

        ReferralCollection GetReferrals(Int32 page, Int32 pageSize, out Int32 totalItems, ReferralSortOrder[] sortOrder);

        ReferralCollection GetReferrals(Campaign campaign, Int32 page, Int32 pageSize, ReferralSortOrder[] sortOrder);

        ReferralCollection GetReferrals(Campaign campaign, Int32 page, Int32 pageSize, out Int32 totalItems, ReferralSortOrder[] sortOrder);

        ReferralCollection GetReferrals(IUser referrer, Int32 page, Int32 pageSize, ReferralSortOrder[] sortOrder);

        ReferralCollection GetReferrals(IUser referrer, Int32 page, Int32 pageSize, out Int32 totalItems, ReferralSortOrder[] sortOrder);

        ReferralCollection GetReferrals(IUser referrer, Campaign campaign, Int32 page, Int32 pageSize, ReferralSortOrder[] sortOrder);

        ReferralCollection GetReferrals(IUser referrer, Campaign campaign, Int32 page, Int32 pageSize, out Int32 totalItems,
                                        ReferralSortOrder[] sortOrder);

        Referral GetReferral(Int32 id);

        Referral GetReferral(Guid guid);

        Referral GetReferral(String referredEmail);

        Int32 GetNumberOfReferrals(Boolean returnRegistered);

        Int32 GetNumberOfReferrals(IUser user, Boolean returnRegistered);

        UserCollection GetReferrers();

        UserCollection GetReferrers(DateTime fromDate, DateTime toDate);

        Campaign AddCampaign(Campaign campaign);

        void UpdateCampaign(Campaign campaign);

        void RemoveCampaign(Campaign campaign);

        Campaign GetCampaign(Int32 id);

        CampaignCollection GetCampaigns(SiteCollection sites, NullValueAction siteNullAction, Int32 page, Int32 pageSize,
                                        CampaignSortOrder[] sortOrder);

        CampaignCollection GetCampaigns(SiteCollection sites, NullValueAction siteNullAction, Int32 page, Int32 pageSize,
                                        out Int32 totalItems, CampaignSortOrder[] sortOrder);

        event EPiServerCommonEventHandler ReferralAdded;

        event EPiServerCommonEventHandler ReferralUpdated;

        event EPiServerCommonEventHandler ReferralRemoved;

        event EPiServerCommonEventHandler CampaignAdded;

        event EPiServerCommonEventHandler CampaignUpdated;

        event EPiServerCommonEventHandler CampaignRemoved;

        CampaignCollection GetQueryResult(CampaignQuery query);

        CampaignCollection GetQueryResult(CampaignQuery query, Int32 page, Int32 pageSize);

        CampaignCollection GetQueryResult(CampaignQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);

        ReferralCollection GetQueryResult(ReferralQuery query);

        ReferralCollection GetQueryResult(ReferralQuery query, Int32 page, Int32 pageSize);

        ReferralCollection GetQueryResult(ReferralQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);
    }
}